<%--
 *  File:   zylstdbusinessareapop.jsp
 *  @Author: Saraxia
 *  Date:    2012/10/12
 *
 *  Copyright (C) 2000 - 2002 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.*" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  Category cat = Category.getInstance("jsp.zylstdbusinessareapop");
  String strModuleName = "COM";
  String strTableName = "v_areacitymapping";
  String contextPath = request.getContextPath(); 
%>

<%@include file="/inc/PageDefault.inc"%>

<html>
<head>
<title>zylstdbusinessareapop</title>
<PageFlow:CheckPageFlow pageName="p_zylstdarea"/>
<script language="JavaScript" src="../../js/ScriptLib.js"></script>
<%@include file="/inc/SumDiv.inc"%>
<script language="JavaScript" src="../../js/SummaryDivision.js"></script>
<%
  	Vector totalsummary = (Vector)pageContext.getAttribute("totalsummary");
	HashMap userinfo = (HashMap)session.getAttribute("userinfo");

  	if(totalsummary == null)
  	{
  		totalsummary = new Vector();
  	}
%>
<script language="JavaScript">
function page_summary(actionvalue,orderbyname)
{  
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  editform.action = "zylstdbusinessareapop.jsp?<%= OvalTools.randomURL() %>";
  isRunning = true;
  editform.target = "_self";
  editform.submit();  
}
function closeWindow()
{

  opener.setContact(cform.areaid.value,cform.areatype.value,cform.areaname.value);
  window.close(); 
}
function clickUser(id,type,name)
{

  cform.areaid.value=id;
  cform.areatype.value = type;
  cform.areaname.value = name;
}
</script>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../../css/<%= strLanguageCode %>/script.js"></script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="cform" method="post" action="<%=contextPath %>/Dispatcher"  target="_self">
	<input type="hidden" name="pagename" value="p_zylstdarea">
	<input type="hidden" name="actionname">
	<input type="hidden" name="currentnum"/>
	<custom:hidden property="nostatus"/>

	<input type="hidden" name="numrows" value="<%=totalsummary.size() %>">
<% //--------------------------------------  page location --%>
	<table cellspacing="0" border="0" cellpadding="0">
	   	<tr>
	     	<td>
	
			<table cellspacing="0" border="0" cellpadding="0" onkeydown="if(event.keyCode==13) page_summary('search');">
				<tr>
					<%--<td width="4%"><%= label.getLabelName("L_Type") + label.getLabelName("L_Colon")%>
					</td>
					<td width="8%"><custom:selectdic property ="areatypesql" dictType="ZYLAreaType" defaultValue="------" defaultValueCost="" /></td>--%>
					<td width="6%"><%= label.getLabelName("L_AreaCode") + label.getLabelName("L_Colon")%></td>
					<td width="8%"><custom:text property="areacodesql" size="8"/></td>
					<td width="6%"><%= label.getLabelName("L_AreaName") + label.getLabelName("L_Colon")%></td>
					<td width="55%"><custom:text property="areanamesql" size="25"/>
					<a href="javascript:page_summary('search')"><img src="<%=contextPath%>/images/<%= strLanguageCode %>/go.gif" border="0" ></a></td>
				</tr>
			</table>	
	     	</td>
	    </tr>
	    <tr> 
		    <td> 
		      <table border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
	    	  <div style="overflow:auto;width:900px">
		        <tr class="deepblue-left">
				  <td width="1%" class="title_center">&nbsp;</td>
		        <!-- 
		          <td class="title_center" width="8%"><a href="javascript:page_summary('orderby','areatype')"><%= label.getLabelName("L_Type") %></a>&nbsp;<span class='red'>*</span></td>
		         -->
		          <td class="title_center" width="8%" ><a href="javascript:page_summary('orderby','areacode')"><%= label.getLabelName("L_AreaCode") %></a>&nbsp;</td>
		          <td class="title_center" width="8%" ><a href="javascript:page_summary('orderby','areaname')"><%= label.getLabelName("L_AreaName") %></a>&nbsp;<span class='red'>*</span></td>
		          </tr>
		        <%
	            	int i = 0;
	             	String strClassType = new String();
	                boolean bHasChecked = false;   
	                Integer strAreaType=null;
	            	String strAreaName="";
	            	Integer strStdareaid=null;
	            	//Integer nDefaultUserId = null; 

	          	%>
		         <logic:iterate id="onerow" collection="<%= totalsummary %>" indexId="idx">
		           	<% 
		            	HashMap tempMap = (HashMap)pageContext.getAttribute("onerow");
		                String strIsDisabled = new String("");
		                String strIsChecked = new String("");
		            	if(i%2 == 1)
		            	{
		              		strClassType = "td-listrom";
		            	}else{
		              		strClassType = "";
		            	}
		            	if(!bHasChecked)
		            	{
			            	strIsChecked = "Checked";
			            	bHasChecked = true; 
			                strAreaType = (Integer)(tempMap.get("areatype"));
			                strAreaName= (String)(tempMap.get("areaname"));
			                strStdareaid=(Integer)(tempMap.get("stdareaid"));
		            	}
		            	i++;
		            	
		          	%>
		          	<tr id="tr<%=idx %>" onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'"  onClick="javascript:radiotrue('user<%=JspHelper.filterNull( i )%>');clickUser('<%=JspHelper.filterNull( tempMap.get("stdareaid") )%>','<%=JspHelper.filterNull( tempMap.get("areatype") )%>','<%=JspHelper.filterNull( tempMap.get("areaname") )%>');" class="<%=JspHelper.filterNull( strClassType )%>">
		          		<td id="td" class="title_center" >
		              		<input type="radio" id="user<%=JspHelper.filterNull( i )%>" name="checkuser"  value=<%=JspHelper.filterNull( tempMap.get("stdareaid") )%> class="checkbox" <%= strIsChecked%>>
		            	</td>
            			<td  class="<%=JspHelper.filterNull( strClassType )%>">&nbsp;<%=JspHelper.filterNull( tempMap.get("areacode") )%></td>
            			<td  class="<%=JspHelper.filterNull( strClassType )%>">&nbsp;<%=JspHelper.filterNull( tempMap.get("areaname") )%></td>
		     		 </tr>
		     	 </logic:iterate>
		     	 <input type="hidden" name="areatype" value="<%=JspHelper.filterNull( strAreaType )%>">
        		 <input type="hidden" name="areaname" value="<%=JspHelper.filterNull( strAreaName )%>">
        		 <input type="hidden" name="areaid" value="<%=JspHelper.filterNull( strStdareaid )%>">
			  </div>	
		      <%@ include file="/inc/SummaryAction.inc" %>
		      </table>	      
		      <table width="100%" cellspacing="0" cellpadding="0">
		        <tr> 
		          <td class="summary_top"></td>
		        </tr>
		        <tr >
		        	<td class="td_center">
						<a onclick="closeWindow()"><custom:button type="1" label="L_Ok" imgsrc="edit.gif" border="0" style="width:60"/></a>
					</td>
				</tr>
		      </table>
		    </td>
	  </tr>
	
	</table>
</form>
</body>
</html>